import React from 'react'
import { Link, useSearchParams } from 'react-router-dom'

const User = () => {

    const [params, _] = useSearchParams()

    // url: http://localhost:3000/user/list?qq=1178980144&str=qwer&name=name1&name=name2
    console.log(params.get('qq'));   // 1178980144
    console.log(params.get('str'));     // qwer
    console.log(params.getAll('name')); // ['name1', 'name2']

    return (
        <div>
            <h1>用户</h1>
            <ul>
                <li>
                    <Link to="/user/detail/1">用户1</Link>
                </li>
                <li>

                    <Link to="/user/detail/2">用户2</Link>
                </li>
                <li>

                    <Link to="/user/detail/3">用户3</Link>
                </li>
                <li>

                    <Link to="/user/detail/4">用户4</Link>
                </li>
            </ul>
        </div>
    )
}

export default User